/**
 * @description 搬运元素至lab进行化合反应
 */
import {WORKSTATE, workSwitch} from "./public/CreepPublicAction.js";

export const labOperatorRun = (creep, sourcesIndex) => {
    //工作逻辑转换
    workSwitch(creep, RESOURCE_ENERGY)
    if (creep.memory[WORKSTATE]) {
        workCore(creep)
    } else {
        getSources(creep)
    }
}

const workCore = (creep) => {
    //将携带的资源放入lab
}

/**
 *
 * @param {Creep} creep
 * @param {string} ResourcesType
 */
const getSources = (creep, ResourcesType) => {
    //从terminal中或storage中获取元素
    const terminal = creep.room.terminal
    const storage = creep.room.storage
    if (terminal) {
        if (creep.withdraw(terminal, ResourcesType) === ERR_NOT_IN_RANGE) {
            moveTo(terminal)
        }
    }
}